/**
 * @Description:
 * @Author:       zhengxu
 * @Date: 2021-11-12 10:20:31
 * @LastEditors:  zhengxu
 * @LastEditTime: 2021-11-12 14:20:47
 */
import { createStore } from 'vuex'

// 自动获取modules文件夹下的js文件，动态获取vue仓库配置
const modulesFiles = import.meta.globEager('./modules/*')
let keys = Object.keys(modulesFiles)
const modules = {}
keys.forEach((item) => {
  const key = item.replace(/(\.\/modules\/|\.js)/g, '')
  modules[key] = modulesFiles[item].default
})

export default createStore({
  modules
})
